/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * PainelLateralDireto.java
 *
 * Created on 04/10/2011, 11:12:22
 */
package projetointegrado;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;

/**
 *
 * @author Emerson
 */
public class PainelLateralDireto extends javax.swing.JPanel {
Player player;

   public void paintComponent(Graphics g) {
        Image imagem = new ImageIcon("src/Imagens/set.jpg").getImage();
        g.setColor(Color.DARK_GRAY);
        g.fillRect(0, 0,185,680);
        g.drawImage(imagem, 0,55, this);
        
        
    }
    public void PainelLateralDireito(Player player) {
        this.player = player;
    }
    public PainelLateralDireto() {
       
         
        initComponents();
        jLabel5.setText(ProjetoIntegrado.player.diaSemana);
        System.out.println(ProjetoIntegrado.player.diaSemana);
    }
    public void setDia(String s){
        jLabel5.setText(s);
    }
    
    public void setSkillProg(int i){
        jLabel9.setText(Integer.toString(i));
    }
    
    public void setSkillAdm(int i){
        jLabel10.setText(Integer.toString(i));
    }
    
    public void setSkillMat(int i){
        jLabel12.setText(Integer.toString(i));
    }
    
    public void setSkillHum(int i){
        jLabel11.setText(Integer.toString(i));
    }
    public int calculaTamanhoBarra(Player p){
        int percent;
        int percent2;
        percent = p.getHpAtual()*100/p.getHp();
        percent2 = percent*135/100;
        return percent2;
    }
    public int calculaTamanhoBarraMana(Player p){
        int percent;
        int percent2;
        percent = p.getManaAtual()*100/p.getMana();
        percent2 = percent*135/100;
        return percent2;
    }
    
    public void setBarraVida(int n){
        Dimension d = new Dimension();
        d.setSize(n, 14);
        jPanel1.setPreferredSize(d);
    }
    
    public void setVida(int n){
        labelVida.setText(Integer.toString(n));
        
        
    }
    
    public void setMana(int n){
        labelMana.setText(Integer.toString(n));
    }
    public void setBarraMana(int n){
        Dimension d1 = new Dimension();
        d1.setSize(n, 14);
        jPanel2.setPreferredSize(d1);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        labelVida = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        labelMana = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        jButton5 = new javax.swing.JButton();
        jButton6 = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();

        setBackground(new java.awt.Color(0, 0, 0));
        setPreferredSize(new java.awt.Dimension(185, 680));
        setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        labelVida.setForeground(new java.awt.Color(255, 255, 255));
        labelVida.setText("Vida");
        add(labelVida, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 11, -1, -1));

        jPanel1.setBackground(new java.awt.Color(51, 255, 0));
        jPanel1.setPreferredSize(new java.awt.Dimension(135, 14));

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 135, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 14, Short.MAX_VALUE)
        );

        add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 11, -1, -1));

        labelMana.setForeground(new java.awt.Color(255, 255, 255));
        labelMana.setText("Mana");
        add(labelMana, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 31, -1, -1));

        jPanel2.setBackground(new java.awt.Color(0, 0, 255));

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 135, Short.MAX_VALUE)
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 14, Short.MAX_VALUE)
        );

        add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 31, -1, -1));

        jLabel4.setBackground(new java.awt.Color(255, 255, 255));
        jLabel4.setForeground(new java.awt.Color(255, 255, 255));
        jLabel4.setText("Dia da semana:");
        add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 280, -1, -1));

        jLabel5.setForeground(new java.awt.Color(255, 0, 0));
        jLabel5.setText(ProjetoIntegrado.player.getDiaSemana());
        add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 280, 120, -1));

        jButton1.setText("Ir para Casa");
        jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton1MouseClicked(evt);
            }
        });
        add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 310, 160, -1));

        jButton2.setText("Menu");
        jButton2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton2MouseClicked(evt);
            }
        });
        add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 340, 160, -1));

        jButton3.setText("Salvar Jogo");
        jButton3.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton3MouseClicked(evt);
            }
        });
        add(jButton3, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 370, 160, -1));

        jButton4.setText("Matriz Curricular");
        jButton4.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton4MouseClicked(evt);
            }
        });
        add(jButton4, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 400, 160, -1));

        jButton5.setText("Ensalamento");
        jButton5.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton5MouseClicked(evt);
            }
        });
        add(jButton5, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 430, 160, -1));

        jButton6.setText("Mapa");
        jButton6.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton6MouseClicked(evt);
            }
        });
        add(jButton6, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 460, 160, -1));

        jLabel2.setForeground(new java.awt.Color(255, 255, 255));
        jLabel2.setText("Level:");
        add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 490, -1, -1));

        jLabel3.setForeground(new java.awt.Color(255, 255, 255));
        jLabel3.setText("Skill Informática:");
        add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 510, -1, -1));

        jLabel6.setForeground(new java.awt.Color(255, 255, 255));
        jLabel6.setText("Skill Gestão:");
        add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 530, -1, -1));

        jLabel7.setForeground(new java.awt.Color(255, 255, 255));
        jLabel7.setText("Skill Humanas:");
        add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 550, -1, -1));

        jLabel8.setForeground(new java.awt.Color(255, 255, 255));
        jLabel8.setText("Skill Matemática:");
        add(jLabel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 570, -1, -1));

        jLabel9.setForeground(new java.awt.Color(255, 255, 255));
        jLabel9.setText(Integer.toString(ProjetoIntegrado.player.getSkillProg()));
        add(jLabel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 510, -1, -1));

        jLabel10.setForeground(new java.awt.Color(255, 255, 255));
        jLabel10.setText(Integer.toString(ProjetoIntegrado.player.getSkillAdm()));
        add(jLabel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 530, -1, -1));

        jLabel11.setForeground(new java.awt.Color(255, 255, 255));
        jLabel11.setText(Integer.toString(ProjetoIntegrado.player.getSkillHum()));
        add(jLabel11, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 550, -1, -1));

        jLabel12.setForeground(new java.awt.Color(255, 255, 255));
        jLabel12.setText(Integer.toString(ProjetoIntegrado.player.getSkillMat()));
        add(jLabel12, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 570, -1, -1));

        jLabel1.setForeground(new java.awt.Color(255, 255, 255));
        jLabel1.setText(Integer.toString(ProjetoIntegrado.player.periodo));
        add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 490, -1, -1));
    }// </editor-fold>//GEN-END:initComponents

private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked
    ProjetoIntegrado.sound.stopAll();
    ProjetoIntegrado.sound.stopMidi();
    if(Flag.emCasa == false){
       ProjetoIntegrado.sound.stopMidi();
       Flag.emCasa = true;
       ProjetoIntegrado.pc.setVisible(true);
       ProjetoIntegrado.sound.playTravel();
       jButton1.setText("<html>Ir pro <s>inferno</s> CEFET<html>");

       ProjetoIntegrado.player.setHpAtual(ProjetoIntegrado.player.getHp());
       ProjetoIntegrado.player.setManaAtual(ProjetoIntegrado.player.getMana());
       for(int i =0; i < player.materias.size(); i++ ){
           player.materias.get(i).setFeitaNoDia(false);
       }
    }
    
    else{
       ProjetoIntegrado.sound.playMapa();
       if(ProjetoIntegrado.player.getDiaSemana().equals("Segunda")){
           ProjetoIntegrado.player.setDiaSemana("Terça");
           jLabel5.setText(ProjetoIntegrado.player.getDiaSemana());
       }
      else if(ProjetoIntegrado.player.getDiaSemana().equals("Terça")){
           ProjetoIntegrado.player.setDiaSemana("Quarta");
           jLabel5.setText(ProjetoIntegrado.player.getDiaSemana());
       }
      else if(ProjetoIntegrado.player.getDiaSemana().equals("Quarta")){
           ProjetoIntegrado.player.setDiaSemana("Quinta");
           jLabel5.setText(ProjetoIntegrado.player.getDiaSemana());
       }
      else if(ProjetoIntegrado.player.getDiaSemana().equals("Quinta")){
           ProjetoIntegrado.player.setDiaSemana("Sexta");
           jLabel5.setText(ProjetoIntegrado.player.getDiaSemana());
       }
      else if(ProjetoIntegrado.player.getDiaSemana().equals("Sexta")){
           ProjetoIntegrado.player.setDiaSemana("Sabado");
           jLabel5.setText(ProjetoIntegrado.player.getDiaSemana());
       }
       else if(ProjetoIntegrado.player.getDiaSemana().equals("Sabado")){
           for(int i =0; i < player.materias.size(); i++ ){
           player.materias.get(i).setFeitaNaSemana(0);
       }
           ProjetoIntegrado.player.setDiaSemana("Segunda");
           jLabel5.setText(ProjetoIntegrado.player.getDiaSemana());
       }
        Flag.emCasa = false;
        Flag.irParaMapa = true;
        ProjetoIntegrado.pc.setVisible(false);
        ProjetoIntegrado.mb.setVisible(true);
        jButton1.setText("Ir para Casa");
        this.repaint();
    }
}//GEN-LAST:event_jButton1MouseClicked

private void jButton3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton3MouseClicked
try{ SalvaPlayer sp = new SalvaPlayer(player);
   }
   catch(Exception e){
       System.err.println("ERRO NOOB");
   }
}//GEN-LAST:event_jButton3MouseClicked

private void jButton4MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton4MouseClicked
if(Flag.irParaMatriz == false){
      Flag.irParaMatriz = true;
      ProjetoIntegrado.pm.setVisible(true);
      if(ProjetoIntegrado.mb.isVisible()){
          Flag.estavaNoMapa = true;
      ProjetoIntegrado.mb.setVisible(false);  }
      jButton4.setText("Sair da matriz");
    }
    else{
        Flag.irParaMatriz = false;
        Flag.saindoDaMatriz = true;
        ProjetoIntegrado.pm.setVisible(false);
        if(Flag.estavaNoMapa){
        ProjetoIntegrado.mb.setVisible(true);
        Flag.estavaNoMapa = false;}
        jButton4.setText("Matriz Curricular");
    }
}//GEN-LAST:event_jButton4MouseClicked

private void jButton5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton5MouseClicked
if(Flag.irParaEnsalamento == false){
       ProjetoIntegrado.pe = new PainelEnsalamento();
       ProjetoIntegrado.pe.setBounds(0,0,830,600);
       ProjetoIntegrado.janelaPrincipal.add(ProjetoIntegrado.pe);
       Flag.irParaEnsalamento = true;
       ProjetoIntegrado.pe.setVisible(true);
       if(ProjetoIntegrado.mb.isVisible()){
       Flag.estavaNoMapa = true;
       ProjetoIntegrado.mb.setVisible(false);  }
       jButton5.setText("Sair do Ensalamento");
    }
    
    else{
        Flag.irParaEnsalamento = false;
        Flag.saindoEnsalamento = true;
        ProjetoIntegrado.pe.setVisible(false);
        if(Flag.estavaNoMapa){
        ProjetoIntegrado.mb.setVisible(true);
        Flag.estavaNoMapa = false;}
        jButton5.setText("Ensalamento");
    }
}//GEN-LAST:event_jButton5MouseClicked

private void jButton6MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton6MouseClicked
    Flag.irParaMapa = true;
    ProjetoIntegrado.mb.setVisible(true);
    ProjetoIntegrado.sound.stopMidi();
    ProjetoIntegrado.sound.playMapa();
}//GEN-LAST:event_jButton6MouseClicked

private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton2MouseClicked
            JanPrincipal.opcoes.requestFocus();
              JanPrincipal.opcoes.setVisible(true);
}//GEN-LAST:event_jButton2MouseClicked

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButton6;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JLabel labelMana;
    private javax.swing.JLabel labelVida;
    // End of variables declaration//GEN-END:variables
}
